//
//  TodoTypeCell.swift
//  ANOA
//
//  Created by 邱仙凯 on 2022/12/6.
//  Copyright © 2025 aowang. All rights reserved.
//

import UIKit
 
class AuditLeftTypeCell: UITableViewCell {
    
    
    lazy var titleLab:  UILabel = {
        let v :UILabel = UILabel()
        v.font = UIFont.systemFont(ofSize: 15)
        v.numberOfLines = 2
        v.textAlignment = .center
        return v
    }()
    lazy var numBtn:UIButton = {
        var v = UIButton()
        v.setTitleColor(.white, for: .normal)
        v.layer.cornerRadius = 5
        v.setTitle("0", for: .normal)
        v.titleLabel?.font = UIFont.systemFont(ofSize: 12)
        return v
    }()
    lazy var colorV:  UIView = {
        let v  = UIView()
        v.backgroundColor = UIColor(kshex: "#4972F9")
        return v
    }()
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.contentView.addSubview(titleLab)
        self.contentView.addSubview(colorV)
        self.contentView.addSubview(numBtn)
        self.selectionStyle = .none
        colorV.snp.makeConstraints { (make) in
            make.top.equalTo(self.contentView).offset(8)
            make.bottom.equalTo(self.contentView).offset(-8)
            make.left.equalTo(self.contentView)
            make.width.equalTo(4)
        }
        titleLab.snp.makeConstraints { (make) in
            make.centerY.equalTo(self.contentView)
            make.left.equalTo(self.contentView).offset(5)
            make.right.equalTo(self.contentView).offset(-20)
        }
        numBtn.snp.makeConstraints { (make) in
            make.centerY.equalTo(self.contentView)
            make.width.equalTo(20)
            make.height.equalTo(15)
            make.right.equalTo(self.contentView).offset(-1)
        }
    }
 
    func setSelectedx(_ flag:Bool) {
        if flag {
            colorV.isHidden = false
            self.contentView.backgroundColor = Theme.commonBg
            numBtn.backgroundColor = UIColor(kshex: "#4972F9")
            titleLab.textColor = UIColor(kshex: "#4972F9")
        } else {
            colorV.isHidden = true
            self.contentView.backgroundColor = .white
            numBtn.backgroundColor = UIColor(kshex: "#8991B0")
            titleLab.textColor = UIColor(kshex: "#2A304A")
           
        }
    }
   
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
 
    
    
    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)
        
        // Configure the view for the selected state
    }
    
}
